import sys
from xml.etree import ElementTree

def parse(xml):
    doc = ElementTree.parse(source=xml)
    rowset3 = doc.find('ROWSET3')
    parse_library(rowset3)
    rowset4 = doc.find('ROWSET4')
    parse_local(rowset4)
    holdstate = doc.find('HOLDSTATE')
    state = holdstate.find('ROWSET')
    parse_state(state)
    rowset5 = doc.find('ROWSET5')
    parse_type(rowset5)

def print_item(array):
    for item in array:
        print( "<item>%s</item>" % item)
    print

def parse_local(element):
    key = []
    val = []
    for item in element.findall('ROW'):
        key.append(item.find('LOCALCODE').text)
        val.append(item.find('NAME').text)
    print_item(key)
    print_item(val)
    
def parse_library(element):
    key = []
    val = []
    for item in element.findall('ROW'):
        key.append(item.find('LIBCODE').text)
        val.append(item.find('SIMPLENAME').text)
    print_item(key)
    print_item(val)

def parse_state(element):
    key = []
    val = []
    for item in element.findall('ROW'):
        key.append(item.find('STATETYPE').text)
        val.append(item.find('STATENAME').text)
    print_item(key)
    print_item(val)

def parse_type(element):
    key = []
    val = []
    for item in element.findall('ROW'):
        key.append(item.find('CIRTYPE').text)
        val.append(item.find('NAME').text)
    print_item(key)
    print_item(val)

if len(sys.argv) < 2:
    print 'Option error!'
else:
    f = open(sys.argv[1])
    parse(f)
